﻿using System;

namespace WeatherAggregator
{
	public static class Helper
	{
		public static TimeSpan Max(TimeSpan first, TimeSpan second)
		{
			return first >= second ? first : second;
		}

		public static Decimal ConvertFarengeitToCelsium(Decimal valueIntFarengeit)
		{
			return (valueIntFarengeit - 32) * 5 / 9m;
		}

		/// <summary>
		///  Хелпер по созданию контекста данных
		/// </summary>
		public static DataContext GetDataContext(String connectionString)
		{
			if (String.IsNullOrWhiteSpace(connectionString)) throw new ArgumentNullException("connectionString");

			var c = new DataContext(connectionString);

			return c;
		}
	}
}